package clam.apps.adu.metier;

import java.util.ArrayList;

public class Departement
{
	
	private static final String	TAG_ID				= "id";
	private static final String	TAG_LIBELLE			= "libelle";
	private static final String	TAG_ETABLISSEMENT	= "etablissement";
	private int					id;
	private String				libelle;
	private Etablissement		etablissement;
	
	public Departement()
	{
		this.etablissement = new Etablissement();
	}
	
	public Departement(int id)
	{
		this.setId(id);
	}
	
	public Departement(int id, String libelle, Etablissement etablissement)
	{
		this.setId(id);
		this.setLibelle(libelle);
		this.setEtablissement(etablissement);
	}
	
	public static Departement findByLibelle(String $libelle)
	{
		ParserJsonJavaManager pjjm = new ParserJsonJavaManager();
		
		return pjjm.findDepartementByLibelle($libelle);
	}
	
	public static ArrayList<Departement> findByEtablissement(
			Etablissement etablissement)
	{
		ParserJsonJavaManager pjjm = new ParserJsonJavaManager();
		
		return pjjm.findAllDepartementByEtablissement(etablissement);
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString()
	{
		return "Departement [id=" + this.id + ", libelle=" + this.libelle
				+ ", etablissement=" + this.etablissement.toString() + "]";
	}
	
	/**
	 * @return the tagId
	 */
	public static String getTagId()
	{
		return Departement.TAG_ID;
	}
	
	/**
	 * @return the tagLibelle
	 */
	public static String getTagLibelle()
	{
		return Departement.TAG_LIBELLE;
	}
	
	/**
	 * @return the tagEtablissement
	 */
	public static String getTagEtablissement()
	{
		return Departement.TAG_ETABLISSEMENT;
	}
	
	public int getId()
	{
		return this.id;
	}
	
	public void setId(Integer id)
	{
		this.id = id;
	}
	
	public String getLibelle()
	{
		return this.libelle;
	}
	
	public void setLibelle(String libelle)
	{
		this.libelle = libelle;
	}
	
	public Etablissement getEtablissement()
	{
		return this.etablissement;
	}
	
	public void setEtablissement(Etablissement etablissement)
	{
		this.etablissement = etablissement;
	}
}
